package exec;

import java.util.Arrays;

public class Exec02 {

    public static void main(String[] args) {
        // 数组排序
        String[] names = {"安琪拉", "王昭君", "蔡文姬", "妲己", "张良"};
        String[] courses = {"C++", "Java", "Python"};
        int[][] scores = {
                {90, 89, 75},
                {59, 40, 100},
                {100, 99, 80},
                {80, 61, 61},
                {60, 100, 99},
        };
        // 1. 设计程序按照各个学生的 Java 成绩进行排序 ( 降序 )
        int key = 1;
        for (int i = 0; i < scores.length; i++) {
            for (int j = 0; j < scores.length - 1; j++) {
                // 比较前面的和后面的
                // 冒泡排序
                if (scores[j][1]  < scores[j + 1][1]) {
//                    scores[j] = scores[j + 1] ^ scores[j];
//                    scores[j + 1] = scores[j + 1] ^ scores[j];
//                    scores[j] = scores[j + 1] ^ scores[j];
                    int[] arr = scores[j + 1];
                    scores[j + 1] = scores[j];
                    scores[j] = arr;
                }
            }
        }
        for (int i = 0; i < scores.length; i++) {
            System.out.println(Arrays.toString(scores[i]));
        }
    }
}
